Vue.component('my-aside',{
    data:function () {
        return{
            user:localStorage.user?JSON.parse(localStorage.user):null
        }
    },
    methods:{
        handleSelect(key,keyPath){
            if (key==1){
                location.href="/";
            }
        },
        logout(){
            if (confirm("您确认退出登录吗?")){
                axios.get("/v1/users/logout").then(function (response) {
                    if (response.data.code==1){
                        localStorage.clear();
                        location.href="/login.html";
                    }
                })
            }
        },
        index(){
            location.href='index.html'
        }

    },
    template:`
         <el-aside class="el-aside" width="200px" style="padding: 15px">
      <!-- 1.1图标 -->
      <el-button class="el-button" type="info" @click="index()">
        <i style="margin-bottom: 10px;
                font-size: 2rem;
                line-height: 4rem" class="el-icon-video-camera-solid">土土乐</i>
      </el-button>
        
     
      <!-- 1.2左边栏 -->
      <ul>
        <li><a href="javascript:;">首页</a></li>
        <li><a href="javascript:;">推荐</a></li>
        <li><a href="javascript:;">关注</a></li>
        <li><a href="javascript:;">朋友</a></li>
        <li><a href="javascript:;">我的</a></li>
      </ul>
      <el-divider></el-divider>
      <ul>
        <li><a href="javascript:;">直播</a></li>
        <li><a href="javascript:;">放映室</a></li>
        <li><a href="javascript:;">知识</a></li>
        <li><a href="javascript:;">热点</a></li>
        <li><a href="javascript:;">游戏</a></li>
        <li><a href="javascript:;">娱乐</a></li>
        <li><a href="javascript:;">二次元</a></li>
        <li><a href="javascript:;">音乐</a></li>
        <li><a href="javascript:;">美食</a></li>
        <li><a href="javascript:;">体育</a></li>
        <li><a href="javascript:;">时尚</a></li>
        <el-divider></el-divider>
        <li ><a href="javascript:;">业务合作</a></li>
      </ul>
      <!-- 1.2左边栏结束 -->
    </el-aside>
    `
})